import Fingerprint2 from 'fingerprintjs2'

/**
 * @name isDev
 * @desc 判断是否为开发模式
 */
const isDev = process.env.NODE_ENV === 'development'

function getBrowserId() {
  // 排除一些可能由于用户操作,导致的变化
  const options = {
    excludes: {
      deviceMemory: false,
      availableScreenResolution: false
    }
  }
  return new Promise(resolve => {
    setTimeout(() => {
      Fingerprint2.getV18(options, (res, components) => {
        resolve(res)
      })
    }, 250)
  })
}

export { isDev, getBrowserId }
